<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
<title>商品分类信息</title>
<%@ include file="/WEB-INF/jsp/public/commons.jspf"%>
<script type="text/javascript">
	$(function() {

		var yz1 = true;
		var yz2 = true;
		var aj=true;
		if ($("#yz1").val() == "") {
		
		
				//ajax
			function ajx(input) {

			$
					.ajax({
						type : "get",
						url : "${pageContext.request.contextPath}/goodsCate_ajx.do?name="
								+ input.value,
						dataType : "json",

						success : function(data) {
							if (data.success) {
								$("#msg1").html(data.msg);
								yz1 = false;
								aj=false;
							} else {
								$("#msg1").html("");
								yz1 = true;
								aj=true;
							}
						}
					});

			}
		}else{
		
		$("#yz1").attr("readonly",true);
		}


		

		$("#yz1").blur(function() {
			// 验证是否为空
			if ($("#yz1").val().trim() == "") {
				$("#msg1").html("不能为空");
				yz1 = false;
			} else {
				ajx(this);
			}
		});

		$("#yz2").blur(function() {
			if ($("#yz2").val().trim() == "") {
				$("#msg2").html("不能为空");
				yz2 = false;
			} else {
				$("#msg2").html("");
				yz2 = true;
			}
		});

		$("#save").bind("click", function() {
		
				if ($("#yz1").val().trim() == "") {
					$("#msg1").html("不能为空");
					yz1=false;
				} else {
					yz1 = true;
				}
				if ($("#yz2").val().trim() == "") {
					$("#msg2").html("不能为空");
					yz2=false;
				} else {
					yz2 = true;
				}

				if (yz1 && yz2& aj ) {
					return true;
				} else {
					return false;
				}
			
		});
	});
</script>
</head>
<body>
	<!-- 标题显示 -->
	<div id="Title_bar">
		<div id="Title_bar_Head">
			<div id="Title_Head"></div>
			<div id="Title">
				<!--页面标题-->
				<img border="0" width="13" height="13"
					src="${pageContext.request.contextPath}/style/images/title_arrow.gif" />
				商品分类信息
			</div>
			<div id="Title_End"></div>
		</div>
	</div>

	<!--显示表单内容-->
	<div id=MainArea>
		<s:form action="goodsCate_%{id == null ? 'addCate' : 'upCate'}">
			<s:hidden name="id"></s:hidden>
			<div class="ItemBlock_Title1">
				<!-- 信息说明 -->
				<div class="ItemBlock_Title1">
					<img border="0" width="4" height="7"
						src="${pageContext.request.contextPath}/style/blue/images/item_point.gif" />商品分类信息
				</div>
			</div>
			<!-- 表单内容显示 -->
			<div class="ItemBlockBorder">
				<div class="ItemBlock">
					<table cellpadding="0" cellspacing="0" class="mainForm">
						<font color="red"><s:fielderror />
						</font>
						<tr>
							<td>商品分类名</td>
							<td><s:textfield id="yz1" name="name"  cssClass="InputStyle" />
								*<label id="msg1"></label>
							</td>
						</tr>
						<tr>
							<td>描述</td>
							<td><s:textarea id="yz2" name="desc" rows="5"
									cssClass="InputStyle" />*<label id="msg2"></label>
							</td>
						</tr>
					</table>
				</div>
			</div>


			<!-- 表单操作 -->
			<div id="InputDetailBar">
				<input id="save" type="image"
					src="${pageContext.request.contextPath}/style/images/save.png" /> <a
					href="javascript:history.go(-1);"><img
					src="${pageContext.request.contextPath}/style/images/goBack.png" />
				</a>
			</div>
		</s:form>
	</div>


</body>
</html>
